﻿using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;

using HsTec.Mobile.Green.Util;

namespace HsTec.Mobile.Green.DAL
{
    /// <summary>
    /// 数据访问类ReportAnalysisOnline。
    /// </summary>
    public class ReportAnalysisOnlineDAL
    {
        public ReportAnalysisOnlineDAL()
        { }
        #region  成员方法
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(string sExistsWhere)
        {
            return SQLHelper.Exists("tb_ReportAnalysisOnline", sExistsWhere);
        }


        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(HsTec.Mobile.Green.Model.ReportAnalysisOnline model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into tb_ReportAnalysisOnline(");
            strSql.Append("Area_ID,Years,Powers,Powers_1,Powers_1_1,Powers_1_2,Powers_1_2_1,Powers_1_3,Powers_2,Powers_2_1,Powers_3,Powers_3_1,Powers_3_1_1,Powers_3_1_2,Powers_3_1_3,Powers_3_2,Gas,Gas_1,Gas_2,DieselFuel,DieselFuel_1,DieselFuel_2,Energy,Energy_1,Energy_2,Energy_3,Energy_4,Base,Base_1,Base_2,Base_3,Base_4,Base_5,Base_6,Base_7,Base_8,Base_9,Base_10,Outdoor,Intelligent,Intelligent_1,Intelligent_2,Intelligent_3,Switch,Batteries,NewBase,NewBase_1,NewBase_2,NewBase_3,NewBase_4,NewBase_5,NewBase_6,NewBase_7,Recovery,Recovery_1,Recovery_2,Recovery_3,Recovery_4,NewBatteries,NewBatteries_1,NewBatteries_2,NewBatteries_3,Green,Green_1,Green_1_1,Green_2,SIM,SIM_1,SIM_2,Lighting,Lighting_1,Lighting_2,Lighting_3,Lighting_4,Lighting_5,Other,Other_1,Other_2,Other_3,Funds,Funds_1,Funds_2,Funds_3,Harmonic,AddDate,OperatUser,OperatDate,Remark,AuditState,AuditUser)");
            strSql.Append(" values (");
            strSql.Append("@Area_ID,@Years,@Powers,@Powers_1,@Powers_1_1,@Powers_1_2,@Powers_1_2_1,@Powers_1_3,@Powers_2,@Powers_2_1,@Powers_3,@Powers_3_1,@Powers_3_1_1,@Powers_3_1_2,@Powers_3_1_3,@Powers_3_2,@Gas,@Gas_1,@Gas_2,@DieselFuel,@DieselFuel_1,@DieselFuel_2,@Energy,@Energy_1,@Energy_2,@Energy_3,@Energy_4,@Base,@Base_1,@Base_2,@Base_3,@Base_4,@Base_5,@Base_6,@Base_7,@Base_8,@Base_9,@Base_10,@Outdoor,@Intelligent,@Intelligent_1,@Intelligent_2,@Intelligent_3,@Switch,@Batteries,@NewBase,@NewBase_1,@NewBase_2,@NewBase_3,@NewBase_4,@NewBase_5,@NewBase_6,@NewBase_7,@Recovery,@Recovery_1,@Recovery_2,@Recovery_3,@Recovery_4,@NewBatteries,@NewBatteries_1,@NewBatteries_2,@NewBatteries_3,@Green,@Green_1,@Green_1_1,@Green_2,@SIM,@SIM_1,@SIM_2,@Lighting,@Lighting_1,@Lighting_2,@Lighting_3,@Lighting_4,@Lighting_5,@Other,@Other_1,@Other_2,@Other_3,@Funds,@Funds_1,@Funds_2,@Funds_3,@Harmonic,@AddDate,@OperatUser,@OperatDate,@Remark,@AuditState,@AuditUser)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
					new SqlParameter("@Area_ID", SqlDbType.Int,4),
					new SqlParameter("@Years", SqlDbType.Char,6),
					new SqlParameter("@Powers", SqlDbType.Decimal,9),
					new SqlParameter("@Powers_1", SqlDbType.Decimal,9),
					new SqlParameter("@Powers_1_1", SqlDbType.Decimal,9),
					new SqlParameter("@Powers_1_2", SqlDbType.Decimal,9),
					new SqlParameter("@Powers_1_2_1", SqlDbType.Decimal,9),
					new SqlParameter("@Powers_1_3", SqlDbType.Decimal,9),
					new SqlParameter("@Powers_2", SqlDbType.Decimal,9),
					new SqlParameter("@Powers_2_1", SqlDbType.Decimal,9),
					new SqlParameter("@Powers_3", SqlDbType.Decimal,9),
					new SqlParameter("@Powers_3_1", SqlDbType.Decimal,9),
					new SqlParameter("@Powers_3_1_1", SqlDbType.Decimal,9),
					new SqlParameter("@Powers_3_1_2", SqlDbType.Decimal,9),
					new SqlParameter("@Powers_3_1_3", SqlDbType.Decimal,9),
					new SqlParameter("@Powers_3_2", SqlDbType.Decimal,9),
					new SqlParameter("@Gas", SqlDbType.Decimal,9),
					new SqlParameter("@Gas_1", SqlDbType.Decimal,9),
					new SqlParameter("@Gas_2", SqlDbType.Decimal,9),
					new SqlParameter("@DieselFuel", SqlDbType.Decimal,9),
					new SqlParameter("@DieselFuel_1", SqlDbType.Decimal,9),
					new SqlParameter("@DieselFuel_2", SqlDbType.Decimal,9),
					new SqlParameter("@Energy", SqlDbType.Int,4),
					new SqlParameter("@Energy_1", SqlDbType.Int,4),
					new SqlParameter("@Energy_2", SqlDbType.Int,4),
					new SqlParameter("@Energy_3", SqlDbType.Int,4),
					new SqlParameter("@Energy_4", SqlDbType.Int,4),
					new SqlParameter("@Base", SqlDbType.Int,4),
					new SqlParameter("@Base_1", SqlDbType.Int,4),
					new SqlParameter("@Base_2", SqlDbType.Int,4),
					new SqlParameter("@Base_3", SqlDbType.Int,4),
					new SqlParameter("@Base_4", SqlDbType.Int,4),
					new SqlParameter("@Base_5", SqlDbType.Int,4),
					new SqlParameter("@Base_6", SqlDbType.Int,4),
					new SqlParameter("@Base_7", SqlDbType.Int,4),
					new SqlParameter("@Base_8", SqlDbType.Int,4),
					new SqlParameter("@Base_9", SqlDbType.Int,4),
					new SqlParameter("@Base_10", SqlDbType.Int,4),
					new SqlParameter("@Outdoor", SqlDbType.Int,4),
					new SqlParameter("@Intelligent", SqlDbType.Int,4),
					new SqlParameter("@Intelligent_1", SqlDbType.Int,4),
					new SqlParameter("@Intelligent_2", SqlDbType.Int,4),
					new SqlParameter("@Intelligent_3", SqlDbType.VarChar,50),
					new SqlParameter("@Switch", SqlDbType.Int,4),
					new SqlParameter("@Batteries", SqlDbType.Int,4),
					new SqlParameter("@NewBase", SqlDbType.Int,4),
					new SqlParameter("@NewBase_1", SqlDbType.Int,4),
					new SqlParameter("@NewBase_2", SqlDbType.Int,4),
					new SqlParameter("@NewBase_3", SqlDbType.Int,4),
					new SqlParameter("@NewBase_4", SqlDbType.Int,4),
					new SqlParameter("@NewBase_5", SqlDbType.Int,4),
					new SqlParameter("@NewBase_6", SqlDbType.Int,4),
					new SqlParameter("@NewBase_7", SqlDbType.Int,4),
					new SqlParameter("@Recovery", SqlDbType.Int,4),
					new SqlParameter("@Recovery_1", SqlDbType.Int,4),
					new SqlParameter("@Recovery_2", SqlDbType.Int,4),
					new SqlParameter("@Recovery_3", SqlDbType.Int,4),
					new SqlParameter("@Recovery_4", SqlDbType.Int,4),
					new SqlParameter("@NewBatteries", SqlDbType.Int,4),
					new SqlParameter("@NewBatteries_1", SqlDbType.Int,4),
					new SqlParameter("@NewBatteries_2", SqlDbType.Int,4),
					new SqlParameter("@NewBatteries_3", SqlDbType.Int,4),
					new SqlParameter("@Green", SqlDbType.Int,4),
					new SqlParameter("@Green_1", SqlDbType.Int,4),
					new SqlParameter("@Green_1_1", SqlDbType.Int,4),
					new SqlParameter("@Green_2", SqlDbType.Int,4),
					new SqlParameter("@SIM", SqlDbType.Int,4),
					new SqlParameter("@SIM_1", SqlDbType.Int,4),
					new SqlParameter("@SIM_2", SqlDbType.Int,4),
					new SqlParameter("@Lighting", SqlDbType.Int,4),
					new SqlParameter("@Lighting_1", SqlDbType.Int,4),
					new SqlParameter("@Lighting_2", SqlDbType.Int,4),
					new SqlParameter("@Lighting_3", SqlDbType.VarChar,4),
					new SqlParameter("@Lighting_4", SqlDbType.Int,4),
					new SqlParameter("@Lighting_5", SqlDbType.Int,4),
					new SqlParameter("@Other", SqlDbType.Int,4),
					new SqlParameter("@Other_1", SqlDbType.Int,4),
					new SqlParameter("@Other_2", SqlDbType.Decimal,9),
					new SqlParameter("@Other_3", SqlDbType.Int,4),
					new SqlParameter("@Funds", SqlDbType.Decimal,9),
					new SqlParameter("@Funds_1", SqlDbType.Decimal,9),
					new SqlParameter("@Funds_2", SqlDbType.Decimal,9),
					new SqlParameter("@Funds_3", SqlDbType.Decimal,9),
					new SqlParameter("@Harmonic", SqlDbType.Int,4),
					new SqlParameter("@AddDate", SqlDbType.DateTime),
					new SqlParameter("@OperatUser", SqlDbType.Int,4),
					new SqlParameter("@OperatDate", SqlDbType.DateTime),
					new SqlParameter("@Remark", SqlDbType.VarChar,200),
					new SqlParameter("@AuditState", SqlDbType.Char,1),
					new SqlParameter("@AuditUser", SqlDbType.Int,4)};
            parameters[0].Value = model.Area_ID;
            parameters[1].Value = model.Years;
            parameters[2].Value = model.Powers;
            parameters[3].Value = model.Powers_1;
            parameters[4].Value = model.Powers_1_1;
            parameters[5].Value = model.Powers_1_2;
            parameters[6].Value = model.Powers_1_2_1;
            parameters[7].Value = model.Powers_1_3;
            parameters[8].Value = model.Powers_2;
            parameters[9].Value = model.Powers_2_1;
            parameters[10].Value = model.Powers_3;
            parameters[11].Value = model.Powers_3_1;
            parameters[12].Value = model.Powers_3_1_1;
            parameters[13].Value = model.Powers_3_1_2;
            parameters[14].Value = model.Powers_3_1_3;
            parameters[15].Value = model.Powers_3_2;
            parameters[16].Value = model.Gas;
            parameters[17].Value = model.Gas_1;
            parameters[18].Value = model.Gas_2;
            parameters[19].Value = model.DieselFuel;
            parameters[20].Value = model.DieselFuel_1;
            parameters[21].Value = model.DieselFuel_2;
            parameters[22].Value = model.Energy;
            parameters[23].Value = model.Energy_1;
            parameters[24].Value = model.Energy_2;
            parameters[25].Value = model.Energy_3;
            parameters[26].Value = model.Energy_4;
            parameters[27].Value = model.Base;
            parameters[28].Value = model.Base_1;
            parameters[29].Value = model.Base_2;
            parameters[30].Value = model.Base_3;
            parameters[31].Value = model.Base_4;
            parameters[32].Value = model.Base_5;
            parameters[33].Value = model.Base_6;
            parameters[34].Value = model.Base_7;
            parameters[35].Value = model.Base_8;
            parameters[36].Value = model.Base_9;
            parameters[37].Value = model.Base_10;
            parameters[38].Value = model.Outdoor;
            parameters[39].Value = model.Intelligent;
            parameters[40].Value = model.Intelligent_1;
            parameters[41].Value = model.Intelligent_2;
            parameters[42].Value = model.Intelligent_3;
            parameters[43].Value = model.Switch;
            parameters[44].Value = model.Batteries;
            parameters[45].Value = model.NewBase;
            parameters[46].Value = model.NewBase_1;
            parameters[47].Value = model.NewBase_2;
            parameters[48].Value = model.NewBase_3;
            parameters[49].Value = model.NewBase_4;
            parameters[50].Value = model.NewBase_5;
            parameters[51].Value = model.NewBase_6;
            parameters[52].Value = model.NewBase_7;
            parameters[53].Value = model.Recovery;
            parameters[54].Value = model.Recovery_1;
            parameters[55].Value = model.Recovery_2;
            parameters[56].Value = model.Recovery_3;
            parameters[57].Value = model.Recovery_4;
            parameters[58].Value = model.NewBatteries;
            parameters[59].Value = model.NewBatteries_1;
            parameters[60].Value = model.NewBatteries_2;
            parameters[61].Value = model.NewBatteries_3;
            parameters[62].Value = model.Green;
            parameters[63].Value = model.Green_1;
            parameters[64].Value = model.Green_1_1;
            parameters[65].Value = model.Green_2;
            parameters[66].Value = model.SIM;
            parameters[67].Value = model.SIM_1;
            parameters[68].Value = model.SIM_2;
            parameters[69].Value = model.Lighting;
            parameters[70].Value = model.Lighting_1;
            parameters[71].Value = model.Lighting_2;
            parameters[72].Value = model.Lighting_3;
            parameters[73].Value = model.Lighting_4;
            parameters[74].Value = model.Lighting_5;
            parameters[75].Value = model.Other;
            parameters[76].Value = model.Other_1;
            parameters[77].Value = model.Other_2;
            parameters[78].Value = model.Other_3;
            parameters[79].Value = model.Funds;
            parameters[80].Value = model.Funds_1;
            parameters[81].Value = model.Funds_2;
            parameters[82].Value = model.Funds_3;
            parameters[83].Value = model.Harmonic;
            parameters[84].Value = model.AddDate;
            parameters[85].Value = model.OperatUser;
            parameters[86].Value = model.OperatDate;
            parameters[87].Value = model.Remark;
            parameters[88].Value = model.AuditState;
            parameters[89].Value = model.AuditUser;

            return SQLHelper.ExecuteNonQuery(strSql.ToString(), parameters);
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public int Update(HsTec.Mobile.Green.Model.ReportAnalysisOnline model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update tb_ReportAnalysisOnline set ");
            strSql.Append("Area_ID=@Area_ID,");
            strSql.Append("Years=@Years,");
            strSql.Append("Powers=@Powers,");
            strSql.Append("Powers_1=@Powers_1,");
            strSql.Append("Powers_1_1=@Powers_1_1,");
            strSql.Append("Powers_1_2=@Powers_1_2,");
            strSql.Append("Powers_1_2_1=@Powers_1_2_1,");
            strSql.Append("Powers_1_3=@Powers_1_3,");
            strSql.Append("Powers_2=@Powers_2,");
            strSql.Append("Powers_2_1=@Powers_2_1,");
            strSql.Append("Powers_3=@Powers_3,");
            strSql.Append("Powers_3_1=@Powers_3_1,");
            strSql.Append("Powers_3_1_1=@Powers_3_1_1,");
            strSql.Append("Powers_3_1_2=@Powers_3_1_2,");
            strSql.Append("Powers_3_1_3=@Powers_3_1_3,");
            strSql.Append("Powers_3_2=@Powers_3_2,");
            strSql.Append("Gas=@Gas,");
            strSql.Append("Gas_1=@Gas_1,");
            strSql.Append("Gas_2=@Gas_2,");
            strSql.Append("DieselFuel=@DieselFuel,");
            strSql.Append("DieselFuel_1=@DieselFuel_1,");
            strSql.Append("DieselFuel_2=@DieselFuel_2,");
            strSql.Append("Energy=@Energy,");
            strSql.Append("Energy_1=@Energy_1,");
            strSql.Append("Energy_2=@Energy_2,");
            strSql.Append("Energy_3=@Energy_3,");
            strSql.Append("Energy_4=@Energy_4,");
            strSql.Append("Base=@Base,");
            strSql.Append("Base_1=@Base_1,");
            strSql.Append("Base_2=@Base_2,");
            strSql.Append("Base_3=@Base_3,");
            strSql.Append("Base_4=@Base_4,");
            strSql.Append("Base_5=@Base_5,");
            strSql.Append("Base_6=@Base_6,");
            strSql.Append("Base_7=@Base_7,");
            strSql.Append("Base_8=@Base_8,");
            strSql.Append("Base_9=@Base_9,");
            strSql.Append("Base_10=@Base_10,");
            strSql.Append("Outdoor=@Outdoor,");
            strSql.Append("Intelligent=@Intelligent,");
            strSql.Append("Intelligent_1=@Intelligent_1,");
            strSql.Append("Intelligent_2=@Intelligent_2,");
            strSql.Append("Intelligent_3=@Intelligent_3,");
            strSql.Append("Switch=@Switch,");
            strSql.Append("Batteries=@Batteries,");
            strSql.Append("NewBase=@NewBase,");
            strSql.Append("NewBase_1=@NewBase_1,");
            strSql.Append("NewBase_2=@NewBase_2,");
            strSql.Append("NewBase_3=@NewBase_3,");
            strSql.Append("NewBase_4=@NewBase_4,");
            strSql.Append("NewBase_5=@NewBase_5,");
            strSql.Append("NewBase_6=@NewBase_6,");
            strSql.Append("NewBase_7=@NewBase_7,");
            strSql.Append("Recovery=@Recovery,");
            strSql.Append("Recovery_1=@Recovery_1,");
            strSql.Append("Recovery_2=@Recovery_2,");
            strSql.Append("Recovery_3=@Recovery_3,");
            strSql.Append("Recovery_4=@Recovery_4,");
            strSql.Append("NewBatteries=@NewBatteries,");
            strSql.Append("NewBatteries_1=@NewBatteries_1,");
            strSql.Append("NewBatteries_2=@NewBatteries_2,");
            strSql.Append("NewBatteries_3=@NewBatteries_3,");
            strSql.Append("Green=@Green,");
            strSql.Append("Green_1=@Green_1,");
            strSql.Append("Green_1_1=@Green_1_1,");
            strSql.Append("Green_2=@Green_2,");
            strSql.Append("SIM=@SIM,");
            strSql.Append("SIM_1=@SIM_1,");
            strSql.Append("SIM_2=@SIM_2,");
            strSql.Append("Lighting=@Lighting,");
            strSql.Append("Lighting_1=@Lighting_1,");
            strSql.Append("Lighting_2=@Lighting_2,");
            strSql.Append("Lighting_3=@Lighting_3,");
            strSql.Append("Lighting_4=@Lighting_4,");
            strSql.Append("Lighting_5=@Lighting_5,");
            strSql.Append("Other=@Other,");
            strSql.Append("Other_1=@Other_1,");
            strSql.Append("Other_2=@Other_2,");
            strSql.Append("Other_3=@Other_3,");
            strSql.Append("Funds=@Funds,");
            strSql.Append("Funds_1=@Funds_1,");
            strSql.Append("Funds_2=@Funds_2,");
            strSql.Append("Funds_3=@Funds_3,");
            strSql.Append("Harmonic=@Harmonic,");
            strSql.Append("AddDate=@AddDate,");
            strSql.Append("OperatUser=@OperatUser,");
            strSql.Append("OperatDate=@OperatDate,");
            strSql.Append("Remark=@Remark,");
            strSql.Append("AuditState=@AuditState,");
            strSql.Append("AuditUser=@AuditUser");
            strSql.Append(" where RA_ID=@RA_ID ");
            SqlParameter[] parameters = {
					new SqlParameter("@RA_ID", SqlDbType.Int,4),
					new SqlParameter("@Area_ID", SqlDbType.Int,4),
					new SqlParameter("@Years", SqlDbType.Char,6),
					new SqlParameter("@Powers", SqlDbType.Decimal,9),
					new SqlParameter("@Powers_1", SqlDbType.Decimal,9),
					new SqlParameter("@Powers_1_1", SqlDbType.Decimal,9),
					new SqlParameter("@Powers_1_2", SqlDbType.Decimal,9),
					new SqlParameter("@Powers_1_2_1", SqlDbType.Decimal,9),
					new SqlParameter("@Powers_1_3", SqlDbType.Decimal,9),
					new SqlParameter("@Powers_2", SqlDbType.Decimal,9),
					new SqlParameter("@Powers_2_1", SqlDbType.Decimal,9),
					new SqlParameter("@Powers_3", SqlDbType.Decimal,9),
					new SqlParameter("@Powers_3_1", SqlDbType.Decimal,9),
					new SqlParameter("@Powers_3_1_1", SqlDbType.Decimal,9),
					new SqlParameter("@Powers_3_1_2", SqlDbType.Decimal,9),
					new SqlParameter("@Powers_3_1_3", SqlDbType.Decimal,9),
					new SqlParameter("@Powers_3_2", SqlDbType.Decimal,9),
					new SqlParameter("@Gas", SqlDbType.Decimal,9),
					new SqlParameter("@Gas_1", SqlDbType.Decimal,9),
					new SqlParameter("@Gas_2", SqlDbType.Decimal,9),
					new SqlParameter("@DieselFuel", SqlDbType.Decimal,9),
					new SqlParameter("@DieselFuel_1", SqlDbType.Decimal,9),
					new SqlParameter("@DieselFuel_2", SqlDbType.Decimal,9),
					new SqlParameter("@Energy", SqlDbType.Int,4),
					new SqlParameter("@Energy_1", SqlDbType.Int,4),
					new SqlParameter("@Energy_2", SqlDbType.Int,4),
					new SqlParameter("@Energy_3", SqlDbType.Int,4),
					new SqlParameter("@Energy_4", SqlDbType.Int,4),
					new SqlParameter("@Base", SqlDbType.Int,4),
					new SqlParameter("@Base_1", SqlDbType.Int,4),
					new SqlParameter("@Base_2", SqlDbType.Int,4),
					new SqlParameter("@Base_3", SqlDbType.Int,4),
					new SqlParameter("@Base_4", SqlDbType.Int,4),
					new SqlParameter("@Base_5", SqlDbType.Int,4),
					new SqlParameter("@Base_6", SqlDbType.Int,4),
					new SqlParameter("@Base_7", SqlDbType.Int,4),
					new SqlParameter("@Base_8", SqlDbType.Int,4),
					new SqlParameter("@Base_9", SqlDbType.Int,4),
					new SqlParameter("@Base_10", SqlDbType.Int,4),
					new SqlParameter("@Outdoor", SqlDbType.Int,4),
					new SqlParameter("@Intelligent", SqlDbType.Int,4),
					new SqlParameter("@Intelligent_1", SqlDbType.Int,4),
					new SqlParameter("@Intelligent_2", SqlDbType.Int,4),
					new SqlParameter("@Intelligent_3", SqlDbType.VarChar,50),
					new SqlParameter("@Switch", SqlDbType.Int,4),
					new SqlParameter("@Batteries", SqlDbType.Int,4),
					new SqlParameter("@NewBase", SqlDbType.Int,4),
					new SqlParameter("@NewBase_1", SqlDbType.Int,4),
					new SqlParameter("@NewBase_2", SqlDbType.Int,4),
					new SqlParameter("@NewBase_3", SqlDbType.Int,4),
					new SqlParameter("@NewBase_4", SqlDbType.Int,4),
					new SqlParameter("@NewBase_5", SqlDbType.Int,4),
					new SqlParameter("@NewBase_6", SqlDbType.Int,4),
					new SqlParameter("@NewBase_7", SqlDbType.Int,4),
					new SqlParameter("@Recovery", SqlDbType.Int,4),
					new SqlParameter("@Recovery_1", SqlDbType.Int,4),
					new SqlParameter("@Recovery_2", SqlDbType.Int,4),
					new SqlParameter("@Recovery_3", SqlDbType.Int,4),
					new SqlParameter("@Recovery_4", SqlDbType.Int,4),
					new SqlParameter("@NewBatteries", SqlDbType.Int,4),
					new SqlParameter("@NewBatteries_1", SqlDbType.Int,4),
					new SqlParameter("@NewBatteries_2", SqlDbType.Int,4),
					new SqlParameter("@NewBatteries_3", SqlDbType.Int,4),
					new SqlParameter("@Green", SqlDbType.Int,4),
					new SqlParameter("@Green_1", SqlDbType.Int,4),
					new SqlParameter("@Green_1_1", SqlDbType.Int,4),
					new SqlParameter("@Green_2", SqlDbType.Int,4),
					new SqlParameter("@SIM", SqlDbType.Int,4),
					new SqlParameter("@SIM_1", SqlDbType.Int,4),
					new SqlParameter("@SIM_2", SqlDbType.Int,4),
					new SqlParameter("@Lighting", SqlDbType.Int,4),
					new SqlParameter("@Lighting_1", SqlDbType.Int,4),
					new SqlParameter("@Lighting_2", SqlDbType.Int,4),
					new SqlParameter("@Lighting_3", SqlDbType.VarChar,4),
					new SqlParameter("@Lighting_4", SqlDbType.Int,4),
					new SqlParameter("@Lighting_5", SqlDbType.Int,4),
					new SqlParameter("@Other", SqlDbType.Int,4),
					new SqlParameter("@Other_1", SqlDbType.Int,4),
					new SqlParameter("@Other_2", SqlDbType.Decimal,9),
					new SqlParameter("@Other_3", SqlDbType.Int,4),
					new SqlParameter("@Funds", SqlDbType.Decimal,9),
					new SqlParameter("@Funds_1", SqlDbType.Decimal,9),
					new SqlParameter("@Funds_2", SqlDbType.Decimal,9),
					new SqlParameter("@Funds_3", SqlDbType.Decimal,9),
					new SqlParameter("@Harmonic", SqlDbType.Int,4),
					new SqlParameter("@AddDate", SqlDbType.DateTime),
					new SqlParameter("@OperatUser", SqlDbType.Int,4),
					new SqlParameter("@OperatDate", SqlDbType.DateTime),
					new SqlParameter("@Remark", SqlDbType.VarChar,200),
					new SqlParameter("@AuditState", SqlDbType.Char,1),
					new SqlParameter("@AuditUser", SqlDbType.Int,4)};
            parameters[0].Value = model.RA_ID;
            parameters[1].Value = model.Area_ID;
            parameters[2].Value = model.Years;
            parameters[3].Value = model.Powers;
            parameters[4].Value = model.Powers_1;
            parameters[5].Value = model.Powers_1_1;
            parameters[6].Value = model.Powers_1_2;
            parameters[7].Value = model.Powers_1_2_1;
            parameters[8].Value = model.Powers_1_3;
            parameters[9].Value = model.Powers_2;
            parameters[10].Value = model.Powers_2_1;
            parameters[11].Value = model.Powers_3;
            parameters[12].Value = model.Powers_3_1;
            parameters[13].Value = model.Powers_3_1_1;
            parameters[14].Value = model.Powers_3_1_2;
            parameters[15].Value = model.Powers_3_1_3;
            parameters[16].Value = model.Powers_3_2;
            parameters[17].Value = model.Gas;
            parameters[18].Value = model.Gas_1;
            parameters[19].Value = model.Gas_2;
            parameters[20].Value = model.DieselFuel;
            parameters[21].Value = model.DieselFuel_1;
            parameters[22].Value = model.DieselFuel_2;
            parameters[23].Value = model.Energy;
            parameters[24].Value = model.Energy_1;
            parameters[25].Value = model.Energy_2;
            parameters[26].Value = model.Energy_3;
            parameters[27].Value = model.Energy_4;
            parameters[28].Value = model.Base;
            parameters[29].Value = model.Base_1;
            parameters[30].Value = model.Base_2;
            parameters[31].Value = model.Base_3;
            parameters[32].Value = model.Base_4;
            parameters[33].Value = model.Base_5;
            parameters[34].Value = model.Base_6;
            parameters[35].Value = model.Base_7;
            parameters[36].Value = model.Base_8;
            parameters[37].Value = model.Base_9;
            parameters[38].Value = model.Base_10;
            parameters[39].Value = model.Outdoor;
            parameters[40].Value = model.Intelligent;
            parameters[41].Value = model.Intelligent_1;
            parameters[42].Value = model.Intelligent_2;
            parameters[43].Value = model.Intelligent_3;
            parameters[44].Value = model.Switch;
            parameters[45].Value = model.Batteries;
            parameters[46].Value = model.NewBase;
            parameters[47].Value = model.NewBase_1;
            parameters[48].Value = model.NewBase_2;
            parameters[49].Value = model.NewBase_3;
            parameters[50].Value = model.NewBase_4;
            parameters[51].Value = model.NewBase_5;
            parameters[52].Value = model.NewBase_6;
            parameters[53].Value = model.NewBase_7;
            parameters[54].Value = model.Recovery;
            parameters[55].Value = model.Recovery_1;
            parameters[56].Value = model.Recovery_2;
            parameters[57].Value = model.Recovery_3;
            parameters[58].Value = model.Recovery_4;
            parameters[59].Value = model.NewBatteries;
            parameters[60].Value = model.NewBatteries_1;
            parameters[61].Value = model.NewBatteries_2;
            parameters[62].Value = model.NewBatteries_3;
            parameters[63].Value = model.Green;
            parameters[64].Value = model.Green_1;
            parameters[65].Value = model.Green_1_1;
            parameters[66].Value = model.Green_2;
            parameters[67].Value = model.SIM;
            parameters[68].Value = model.SIM_1;
            parameters[69].Value = model.SIM_2;
            parameters[70].Value = model.Lighting;
            parameters[71].Value = model.Lighting_1;
            parameters[72].Value = model.Lighting_2;
            parameters[73].Value = model.Lighting_3;
            parameters[74].Value = model.Lighting_4;
            parameters[75].Value = model.Lighting_5;
            parameters[76].Value = model.Other;
            parameters[77].Value = model.Other_1;
            parameters[78].Value = model.Other_2;
            parameters[79].Value = model.Other_3;
            parameters[80].Value = model.Funds;
            parameters[81].Value = model.Funds_1;
            parameters[82].Value = model.Funds_2;
            parameters[83].Value = model.Funds_3;
            parameters[84].Value = model.Harmonic;
            parameters[85].Value = model.AddDate;
            parameters[86].Value = model.OperatUser;
            parameters[87].Value = model.OperatDate;
            parameters[88].Value = model.Remark;
            parameters[89].Value = model.AuditState;
            parameters[90].Value = model.AuditUser;

            return SQLHelper.ExecuteNonQuery(strSql.ToString(), parameters);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public int Delete(string RA_IDs)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from tb_ReportAnalysisOnline ");
            strSql.Append(" where RA_ID in ( " + RA_IDs + " )");
            return SQLHelper.ExecuteNonQuery(strSql.ToString());
        }


        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public HsTec.Mobile.Green.Model.ReportAnalysisOnline GetModel(int RA_ID)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 RA_ID,Area_ID,Years,Powers,Powers_1,Powers_1_1,Powers_1_2,Powers_1_2_1,Powers_1_3,Powers_2,Powers_2_1,Powers_3,Powers_3_1,Powers_3_1_1,Powers_3_1_2,Powers_3_1_3,Powers_3_2,Energy,Energy_1,Energy_2,Energy_3,Energy_4,Base,Base_1,Base_2,Base_3,Base_4,Base_5,Base_6,Base_7,Base_8,Base_9,Base_10,Outdoor,Intelligent,Intelligent_1,Intelligent_2,Intelligent_3,Switch,Batteries,NewBase,NewBase_1,NewBase_2,NewBase_3,NewBase_4,NewBase_5,NewBase_6,NewBase_7,Recovery,Recovery_1,Recovery_2,Recovery_3,Recovery_4,NewBatteries,NewBatteries_1,NewBatteries_2,NewBatteries_3,Green,Green_1,Green_1_1,Green_2,SIM,SIM_1,SIM_2,Lighting,Lighting_1,Lighting_2,Lighting_3,Lighting_4,Lighting_5,Other,Other_1,Other_2,Other_3,Funds,Funds_1,Funds_2,Funds_3,Harmonic,AddDate,OperatUser,OperatDate,Remark,AuditState,AuditUser,Gas,Gas_1,Gas_2,DieselFuel,DieselFuel_1,DieselFuel_2 from tb_ReportAnalysisOnline ");
            strSql.Append(" where RA_ID=@RA_ID ");
            SqlParameter[] parameters = {
					new SqlParameter("@RA_ID", SqlDbType.Int,4)};
            parameters[0].Value = RA_ID;

            HsTec.Mobile.Green.Model.ReportAnalysisOnline model = new HsTec.Mobile.Green.Model.ReportAnalysisOnline();
            DataSet ds = SQLHelper.ExecuteDataset(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["RA_ID"].ToString() != "")
                {
                    model.RA_ID = int.Parse(ds.Tables[0].Rows[0]["RA_ID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Area_ID"].ToString() != "")
                {
                    model.Area_ID = int.Parse(ds.Tables[0].Rows[0]["Area_ID"].ToString());
                }
                model.Years = ds.Tables[0].Rows[0]["Years"].ToString();
                if (ds.Tables[0].Rows[0]["Powers"].ToString() != "")
                {
                    model.Powers = decimal.Parse(ds.Tables[0].Rows[0]["Powers"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Powers_1"].ToString() != "")
                {
                    model.Powers_1 = decimal.Parse(ds.Tables[0].Rows[0]["Powers_1"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Powers_1_1"].ToString() != "")
                {
                    model.Powers_1_1 = decimal.Parse(ds.Tables[0].Rows[0]["Powers_1_1"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Powers_1_2"].ToString() != "")
                {
                    model.Powers_1_2 = decimal.Parse(ds.Tables[0].Rows[0]["Powers_1_2"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Powers_1_2_1"].ToString() != "")
                {
                    model.Powers_1_2_1 = decimal.Parse(ds.Tables[0].Rows[0]["Powers_1_2_1"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Powers_1_3"].ToString() != "")
                {
                    model.Powers_1_3 = decimal.Parse(ds.Tables[0].Rows[0]["Powers_1_3"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Powers_2"].ToString() != "")
                {
                    model.Powers_2 = decimal.Parse(ds.Tables[0].Rows[0]["Powers_2"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Powers_2_1"].ToString() != "")
                {
                    model.Powers_2_1 = decimal.Parse(ds.Tables[0].Rows[0]["Powers_2_1"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Powers_3"].ToString() != "")
                {
                    model.Powers_3 = decimal.Parse(ds.Tables[0].Rows[0]["Powers_3"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Powers_3_1"].ToString() != "")
                {
                    model.Powers_3_1 = decimal.Parse(ds.Tables[0].Rows[0]["Powers_3_1"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Powers_3_1_1"].ToString() != "")
                {
                    model.Powers_3_1_1 = decimal.Parse(ds.Tables[0].Rows[0]["Powers_3_1_1"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Powers_3_1_2"].ToString() != "")
                {
                    model.Powers_3_1_2 = decimal.Parse(ds.Tables[0].Rows[0]["Powers_3_1_2"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Powers_3_1_3"].ToString() != "")
                {
                    model.Powers_3_1_3 = decimal.Parse(ds.Tables[0].Rows[0]["Powers_3_1_3"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Powers_3_2"].ToString() != "")
                {
                    model.Powers_3_2 = decimal.Parse(ds.Tables[0].Rows[0]["Powers_3_2"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Gas"].ToString() != "")
                {
                    model.Gas = decimal.Parse(ds.Tables[0].Rows[0]["Gas"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Gas_1"].ToString() != "")
                {
                    model.Gas_1 = decimal.Parse(ds.Tables[0].Rows[0]["Gas_1"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Gas_2"].ToString() != "")
                {
                    model.Gas_2 = decimal.Parse(ds.Tables[0].Rows[0]["Gas_2"].ToString());
                }
                if (ds.Tables[0].Rows[0]["DieselFuel"].ToString() != "")
                {
                    model.DieselFuel = decimal.Parse(ds.Tables[0].Rows[0]["DieselFuel"].ToString());
                }
                if (ds.Tables[0].Rows[0]["DieselFuel_1"].ToString() != "")
                {
                    model.DieselFuel_1 = decimal.Parse(ds.Tables[0].Rows[0]["DieselFuel_1"].ToString());
                }
                if (ds.Tables[0].Rows[0]["DieselFuel_2"].ToString() != "")
                {
                    model.DieselFuel_2 = decimal.Parse(ds.Tables[0].Rows[0]["DieselFuel_2"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Energy"].ToString() != "")
                {
                    model.Energy = int.Parse(ds.Tables[0].Rows[0]["Energy"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Energy_1"].ToString() != "")
                {
                    model.Energy_1 = int.Parse(ds.Tables[0].Rows[0]["Energy_1"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Energy_2"].ToString() != "")
                {
                    model.Energy_2 = int.Parse(ds.Tables[0].Rows[0]["Energy_2"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Energy_3"].ToString() != "")
                {
                    model.Energy_3 = int.Parse(ds.Tables[0].Rows[0]["Energy_3"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Energy_4"].ToString() != "")
                {
                    model.Energy_4 = int.Parse(ds.Tables[0].Rows[0]["Energy_4"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Base"].ToString() != "")
                {
                    model.Base = int.Parse(ds.Tables[0].Rows[0]["Base"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Base_1"].ToString() != "")
                {
                    model.Base_1 = int.Parse(ds.Tables[0].Rows[0]["Base_1"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Base_2"].ToString() != "")
                {
                    model.Base_2 = int.Parse(ds.Tables[0].Rows[0]["Base_2"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Base_3"].ToString() != "")
                {
                    model.Base_3 = int.Parse(ds.Tables[0].Rows[0]["Base_3"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Base_4"].ToString() != "")
                {
                    model.Base_4 = int.Parse(ds.Tables[0].Rows[0]["Base_4"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Base_5"].ToString() != "")
                {
                    model.Base_5 = int.Parse(ds.Tables[0].Rows[0]["Base_5"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Base_6"].ToString() != "")
                {
                    model.Base_6 = int.Parse(ds.Tables[0].Rows[0]["Base_6"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Base_7"].ToString() != "")
                {
                    model.Base_7 = int.Parse(ds.Tables[0].Rows[0]["Base_7"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Base_8"].ToString() != "")
                {
                    model.Base_8 = int.Parse(ds.Tables[0].Rows[0]["Base_8"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Base_9"].ToString() != "")
                {
                    model.Base_9 = int.Parse(ds.Tables[0].Rows[0]["Base_9"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Base_10"].ToString() != "")
                {
                    model.Base_10 = int.Parse(ds.Tables[0].Rows[0]["Base_10"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Outdoor"].ToString() != "")
                {
                    model.Outdoor = int.Parse(ds.Tables[0].Rows[0]["Outdoor"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Intelligent"].ToString() != "")
                {
                    model.Intelligent = int.Parse(ds.Tables[0].Rows[0]["Intelligent"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Intelligent_1"].ToString() != "")
                {
                    model.Intelligent_1 = int.Parse(ds.Tables[0].Rows[0]["Intelligent_1"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Intelligent_2"].ToString() != "")
                {
                    model.Intelligent_2 = int.Parse(ds.Tables[0].Rows[0]["Intelligent_2"].ToString());
                }
                model.Intelligent_3 = ds.Tables[0].Rows[0]["Intelligent_3"].ToString();
                if (ds.Tables[0].Rows[0]["Switch"].ToString() != "")
                {
                    model.Switch = int.Parse(ds.Tables[0].Rows[0]["Switch"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Batteries"].ToString() != "")
                {
                    model.Batteries = int.Parse(ds.Tables[0].Rows[0]["Batteries"].ToString());
                }
                if (ds.Tables[0].Rows[0]["NewBase"].ToString() != "")
                {
                    model.NewBase = int.Parse(ds.Tables[0].Rows[0]["NewBase"].ToString());
                }
                if (ds.Tables[0].Rows[0]["NewBase_1"].ToString() != "")
                {
                    model.NewBase_1 = int.Parse(ds.Tables[0].Rows[0]["NewBase_1"].ToString());
                }
                if (ds.Tables[0].Rows[0]["NewBase_2"].ToString() != "")
                {
                    model.NewBase_2 = int.Parse(ds.Tables[0].Rows[0]["NewBase_2"].ToString());
                }
                if (ds.Tables[0].Rows[0]["NewBase_3"].ToString() != "")
                {
                    model.NewBase_3 = int.Parse(ds.Tables[0].Rows[0]["NewBase_3"].ToString());
                }
                if (ds.Tables[0].Rows[0]["NewBase_4"].ToString() != "")
                {
                    model.NewBase_4 = int.Parse(ds.Tables[0].Rows[0]["NewBase_4"].ToString());
                }
                if (ds.Tables[0].Rows[0]["NewBase_5"].ToString() != "")
                {
                    model.NewBase_5 = int.Parse(ds.Tables[0].Rows[0]["NewBase_5"].ToString());
                }
                if (ds.Tables[0].Rows[0]["NewBase_6"].ToString() != "")
                {
                    model.NewBase_6 = int.Parse(ds.Tables[0].Rows[0]["NewBase_6"].ToString());
                }
                if (ds.Tables[0].Rows[0]["NewBase_7"].ToString() != "")
                {
                    model.NewBase_7 = int.Parse(ds.Tables[0].Rows[0]["NewBase_7"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Recovery"].ToString() != "")
                {
                    model.Recovery = int.Parse(ds.Tables[0].Rows[0]["Recovery"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Recovery_1"].ToString() != "")
                {
                    model.Recovery_1 = int.Parse(ds.Tables[0].Rows[0]["Recovery_1"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Recovery_2"].ToString() != "")
                {
                    model.Recovery_2 = int.Parse(ds.Tables[0].Rows[0]["Recovery_2"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Recovery_3"].ToString() != "")
                {
                    model.Recovery_3 = int.Parse(ds.Tables[0].Rows[0]["Recovery_3"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Recovery_4"].ToString() != "")
                {
                    model.Recovery_4 = int.Parse(ds.Tables[0].Rows[0]["Recovery_4"].ToString());
                }
                if (ds.Tables[0].Rows[0]["NewBatteries"].ToString() != "")
                {
                    model.NewBatteries = int.Parse(ds.Tables[0].Rows[0]["NewBatteries"].ToString());
                }
                if (ds.Tables[0].Rows[0]["NewBatteries_1"].ToString() != "")
                {
                    model.NewBatteries_1 = int.Parse(ds.Tables[0].Rows[0]["NewBatteries_1"].ToString());
                }
                if (ds.Tables[0].Rows[0]["NewBatteries_2"].ToString() != "")
                {
                    model.NewBatteries_2 = int.Parse(ds.Tables[0].Rows[0]["NewBatteries_2"].ToString());
                }
                if (ds.Tables[0].Rows[0]["NewBatteries_3"].ToString() != "")
                {
                    model.NewBatteries_3 = int.Parse(ds.Tables[0].Rows[0]["NewBatteries_3"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Green"].ToString() != "")
                {
                    model.Green = int.Parse(ds.Tables[0].Rows[0]["Green"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Green_1"].ToString() != "")
                {
                    model.Green_1 = int.Parse(ds.Tables[0].Rows[0]["Green_1"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Green_1_1"].ToString() != "")
                {
                    model.Green_1_1 = int.Parse(ds.Tables[0].Rows[0]["Green_1_1"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Green_2"].ToString() != "")
                {
                    model.Green_2 = int.Parse(ds.Tables[0].Rows[0]["Green_2"].ToString());
                }
                if (ds.Tables[0].Rows[0]["SIM"].ToString() != "")
                {
                    model.SIM = int.Parse(ds.Tables[0].Rows[0]["SIM"].ToString());
                }
                if (ds.Tables[0].Rows[0]["SIM_1"].ToString() != "")
                {
                    model.SIM_1 = int.Parse(ds.Tables[0].Rows[0]["SIM_1"].ToString());
                }
                if (ds.Tables[0].Rows[0]["SIM_2"].ToString() != "")
                {
                    model.SIM_2 = int.Parse(ds.Tables[0].Rows[0]["SIM_2"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Lighting"].ToString() != "")
                {
                    model.Lighting = int.Parse(ds.Tables[0].Rows[0]["Lighting"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Lighting_1"].ToString() != "")
                {
                    model.Lighting_1 = int.Parse(ds.Tables[0].Rows[0]["Lighting_1"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Lighting_2"].ToString() != "")
                {
                    model.Lighting_2 = int.Parse(ds.Tables[0].Rows[0]["Lighting_2"].ToString());
                }
                model.Lighting_3 = ds.Tables[0].Rows[0]["Lighting_3"].ToString();
                if (ds.Tables[0].Rows[0]["Lighting_4"].ToString() != "")
                {
                    model.Lighting_4 = int.Parse(ds.Tables[0].Rows[0]["Lighting_4"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Lighting_5"].ToString() != "")
                {
                    model.Lighting_5 = int.Parse(ds.Tables[0].Rows[0]["Lighting_5"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Other"].ToString() != "")
                {
                    model.Other = int.Parse(ds.Tables[0].Rows[0]["Other"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Other_1"].ToString() != "")
                {
                    model.Other_1 = int.Parse(ds.Tables[0].Rows[0]["Other_1"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Other_2"].ToString() != "")
                {
                    model.Other_2 = decimal.Parse(ds.Tables[0].Rows[0]["Other_2"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Other_3"].ToString() != "")
                {
                    model.Other_3 = int.Parse(ds.Tables[0].Rows[0]["Other_3"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Funds"].ToString() != "")
                {
                    model.Funds = decimal.Parse(ds.Tables[0].Rows[0]["Funds"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Funds_1"].ToString() != "")
                {
                    model.Funds_1 = decimal.Parse(ds.Tables[0].Rows[0]["Funds_1"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Funds_2"].ToString() != "")
                {
                    model.Funds_2 = decimal.Parse(ds.Tables[0].Rows[0]["Funds_2"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Funds_3"].ToString() != "")
                {
                    model.Funds_3 = decimal.Parse(ds.Tables[0].Rows[0]["Funds_3"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Harmonic"].ToString() != "")
                {
                    model.Harmonic = int.Parse(ds.Tables[0].Rows[0]["Harmonic"].ToString());
                }
                if (ds.Tables[0].Rows[0]["AddDate"].ToString() != "")
                {
                    model.AddDate = DateTime.Parse(ds.Tables[0].Rows[0]["AddDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["OperatUser"].ToString() != "")
                {
                    model.OperatUser = int.Parse(ds.Tables[0].Rows[0]["OperatUser"].ToString());
                }
                if (ds.Tables[0].Rows[0]["OperatDate"].ToString() != "")
                {
                    model.OperatDate = DateTime.Parse(ds.Tables[0].Rows[0]["OperatDate"].ToString());
                }
                model.Remark = ds.Tables[0].Rows[0]["Remark"].ToString();
                model.AuditState = ds.Tables[0].Rows[0]["AuditState"].ToString();
                if (ds.Tables[0].Rows[0]["AuditUser"].ToString() != "")
                {
                    model.AuditUser = int.Parse(ds.Tables[0].Rows[0]["AuditUser"].ToString());
                }
                return model;
            }
            else
            {
                return null;
            }
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataView GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select RA_ID,Area_ID,Years,Powers,Powers_1,Powers_1_1,Powers_1_2,Powers_1_2_1,Powers_1_3,Powers_2,Powers_2_1,Powers_3,Powers_3_1,Powers_3_1_1,Powers_3_1_2,Powers_3_1_3,Powers_3_2,Gas,Gas_1,Gas_2,DieselFuel,DieselFuel_1,DieselFuel_2,Energy,Energy_1,Energy_2,Energy_3,Energy_4,Base,Base_1,Base_2,Base_3,Base_4,Base_5,Base_6,Base_7,Base_8,Base_9,Base_10,Outdoor,Intelligent,Intelligent_1,Intelligent_2,Intelligent_3,Switch,Batteries,NewBase,NewBase_1,NewBase_2,NewBase_3,NewBase_4,NewBase_5,NewBase_6,NewBase_7,Recovery,Recovery_1,Recovery_2,Recovery_3,Recovery_4,NewBatteries,NewBatteries_1,NewBatteries_2,NewBatteries_3,Green,Green_1,Green_1_1,Green_2,SIM,SIM_1,SIM_2,Lighting,Lighting_1,Lighting_2,Lighting_3,Lighting_4,Lighting_5,Other,Other_1,Other_2,Other_3,Funds,Funds_1,Funds_2,Funds_3,Harmonic,AddDate,OperatUser,OperatDate,Remark,AuditState,AuditUser,Name ");
            strSql.Append(" FROM vi_ReportAnalysisOnline ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return SQLHelper.ExecuteDataView(strSql.ToString());
        }

        /// <summary>
        /// 获得前几行数据
        /// </summary>
        public DataView GetList(int Top, string strWhere, string filedOrder)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select ");
            if (Top > 0)
            {
                strSql.Append(" top " + Top.ToString());
            }
            strSql.Append(" RA_ID,Area_ID,Years,Powers,Powers_1,Powers_1_1,Powers_1_2,Powers_1_2_1,Powers_1_3,Powers_2,Powers_2_1,Powers_3,Powers_3_1,Powers_3_1_1,Powers_3_1_2,Powers_3_1_3,Powers_3_2,Energy,Energy_1,Energy_2,Energy_3,Energy_4,Base,Base_1,Base_2,Base_3,Base_4,Base_5,Base_6,Base_7,Base_8,Base_9,Base_10,Outdoor,Intelligent,Intelligent_1,Intelligent_2,Intelligent_3,Switch,Batteries,NewBase,NewBase_1,NewBase_2,NewBase_3,NewBase_4,NewBase_5,NewBase_6,NewBase_7,Recovery,Recovery_1,Recovery_2,Recovery_3,Recovery_4,NewBatteries,NewBatteries_1,NewBatteries_2,NewBatteries_3,Green,Green_1,Green_1_1,Green_2,SIM,SIM_1,SIM_2,Lighting,Lighting_1,Lighting_2,Lighting_3,Lighting_4,Lighting_5,Other,Other_1,Other_2,Other_3,Funds,Funds_1,Funds_2,Funds_3,Harmonic,AddDate,OperatUser,OperatDate,Remark,AuditState,AuditUser ");
            strSql.Append(" FROM tb_ReportAnalysisOnline ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            strSql.Append(" order by " + filedOrder);
            return SQLHelper.ExecuteDataView(strSql.ToString());
        }
        #endregion  成员方法

        public int Aduit(string ids)
        {
            try
            {
                foreach (string tmp in ids.Split(','))
                {
                    StringBuilder strSql = new StringBuilder();
                    strSql.Append("insert into [tb_ReportAnalysis](");
                    strSql.Append("Area_ID,Years,Powers,Powers_1,Powers_1_1,Powers_1_2,Powers_1_2_1,Powers_1_3,Powers_2,Powers_2_1,Powers_3,Powers_3_1,Powers_3_1_1,Powers_3_1_2,Powers_3_1_3,Powers_3_2,Gas,Gas_1,Gas_2,DieselFuel,DieselFuel_1,DieselFuel_2,Energy,Energy_1,Energy_2,Energy_3,Energy_4,Base,Base_1,Base_2,Base_3,Base_4,Base_5,Base_6,Base_7,Base_8,Base_9,Base_10,Outdoor,Intelligent,Intelligent_1,Intelligent_2,Intelligent_3,Switch,Batteries,NewBase,NewBase_1,NewBase_2,NewBase_3,NewBase_4,NewBase_5,NewBase_6,NewBase_7,Recovery,Recovery_1,Recovery_2,Recovery_3,Recovery_4,NewBatteries,NewBatteries_1,NewBatteries_2,NewBatteries_3,Green,Green_1,Green_1_1,Green_2,SIM,SIM_1,SIM_2,Lighting,Lighting_1,Lighting_2,Lighting_3,Lighting_4,Lighting_5,Other,Other_1,Other_2,Other_3,Funds,Funds_1,Funds_2,Funds_3,Harmonic,AddDate,OperatUser,OperatDate,Remark");
                    strSql.Append(")");
                    strSql.Append(" select Area_ID,Years,Powers,Powers_1,Powers_1_1,Powers_1_2,Powers_1_2_1,Powers_1_3,Powers_2,Powers_2_1,Powers_3,Powers_3_1,Powers_3_1_1,Powers_3_1_2,Powers_3_1_3,Powers_3_2,Gas,Gas_1,Gas_2,DieselFuel,DieselFuel_1,DieselFuel_2,Energy,Energy_1,Energy_2,Energy_3,Energy_4,Base,Base_1,Base_2,Base_3,Base_4,Base_5,Base_6,Base_7,Base_8,Base_9,Base_10,Outdoor,Intelligent,Intelligent_1,Intelligent_2,Intelligent_3,Switch,Batteries,NewBase,NewBase_1,NewBase_2,NewBase_3,NewBase_4,NewBase_5,NewBase_6,NewBase_7,Recovery,Recovery_1,Recovery_2,Recovery_3,Recovery_4,NewBatteries,NewBatteries_1,NewBatteries_2,NewBatteries_3,Green,Green_1,Green_1_1,Green_2,SIM,SIM_1,SIM_2,Lighting,Lighting_1,Lighting_2,Lighting_3,Lighting_4,Lighting_5,Other,Other_1,Other_2,Other_3,Funds,Funds_1,Funds_2,Funds_3,Harmonic,AddDate,OperatUser,OperatDate,Remark from tb_ReportAnalysisOnline where RA_ID='" + tmp + "'");
                    SQLHelper.ExecuteNonQuery(strSql.ToString());
                    SQLHelper.ExecuteNonQuery("update tb_ReportAnalysisOnline set AuditState='3' where RA_ID = '" + tmp + "'");
                }
            }
            catch
            {
                return 0;
            }
            return 1;
        }

        /// <summary>
        /// 获取表中的所有字段名称
        /// </summary>
        /// <param name="tableName"></param>
        /// <returns></returns>
        public System.Collections.Generic.List<string> getTableField(string tableName)
        {
            System.Collections.Generic.List<string> list = new System.Collections.Generic.List<string>();
            DataView mydv = SQLHelper.ExecuteDataView("Select name from syscolumns Where ID=OBJECT_ID('" + tableName + "')");
            for (int i = 0; i < mydv.Count; i++)
            {
                list.Add(mydv[i][0].ToString());
            }
            return list;
        }
    }
}

